<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('shop/layout/headerMenu'); ?>
        </div>
    </div>
</div>
</div>

<?php
$form = $this->form;
$form->prepare();
$form->setAttributes(['class' => 'form-horizontal']);

$form->get('loginAccount')->setAttributes([
    'class' => 'form-control',
    'placeholder' => $this->translate('登录账号')
]);
$form->get('loginPassword')->setAttributes([
    'class' => 'form-control',
    'placeholder' => $this->translate('登录密码')
]);
?>

<div class="container">
    <div class="xm-plain-box">
        <div class="box-hd">
            <h3 class="title"><?php echo $this->translate('会员登录'); ?></h3>
        </div>
        <div class="box-bd">
            <div class="row">
                <?php echo $this->form()->openTag($form); ?>
                <?php echo $this->formElement($form->get('shopCsrf')); ?>
                <?php echo $this->formElementErrors($form->get('shopCsrf'), ['class'=>'error-message']); ?>
                    <div class="control-group">
                        <?php echo $this->partial('shop/message'); ?>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('会员名称'); ?><span class="must_add_value">*</span>：</label>
                        <div class="controls">
                            <?php echo $this->formElement($form->get('loginAccount')); ?>
                            <?php echo $this->formElementErrors($form->get('loginAccount'), ['class'=>'error-message']); ?>
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="input01" class="control-label"><?php echo $this->translate('会员密码'); ?><span class="must_add_value">*</span>：</label>
                        <div class="controls">
                            <?php echo $this->formElement($form->get('loginPassword')); ?>
                            <?php echo $this->formElementErrors($form->get('loginPassword'), ['class'=>'error-message']); ?>
                        </div>
                    </div>
                    <?php if($this->shopHelper()->shop('user_login_captcha', 'captcha') == 1) { ?>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('验证码'); ?><span class="must_add_value">*</span>：</label>
                            <div class="controls">
                                <?php echo $this->formElement($form->get('userLoginCaptcha')->setAttributes(['class' => 'form-control', 'placeholder' => $this->translate('输入上面的验证码')])); ?>
                                <?php echo $this->formElementErrors($form->get('userLoginCaptcha'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                    <?php } ?>
                    <div class="control-group">
                        <div class="controls">
                            <?php echo $this->formElement($form->get('httpReferer')); ?>
                            <button class="btn btn-primary" type="submit"><?php echo $this->translate('会员登录'); ?></button>
                            &nbsp;&nbsp;
                            &nbsp;&nbsp;<button class="btn" type="button" onclick="location.href='<?php echo $this->url('shop-user', ['action' => 'userRegister'], ['query' => ['httpReferer' => $form->get('httpReferer')->getValue()]]); ?>'"><?php echo $this->translate('还不是会员，去注册会员'); ?></button>
                            <p style="margin-top:10px;"><a href="<?php echo $this->url('shop-user', ['action' => 'userForgetPassword']); ?>"><?php echo $this->translate('会员忘记密码'); ?></a></p>
                        </div>
                    </div>
                    <?php if (!empty($this->enableLogin)) { ?>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('其他登录'); ?>：</label>
                            <div class="controls">
                                <?php foreach ($this->enableLogin AS $loginValue) { ?>
                                  <a href="<?php echo $this->url('shop-user', ['action' => 'otherLogin'], ['query' => ['loginType' => $loginValue]]); ?>" style="margin-right: 8px;"><img src="<?php echo $this->basePath('template/pc/default/img/'.$loginValue.'.png'); ?>" style="width: 36px;"></a>
                                <?php } ?>
                            </div>
                        </div>
                    <?php } ?>
                <?php echo $this->form()->closeTag(); ?>
            </div>
        </div>
    </div>
</div>

<script>
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                loginAccount: {
                    required: true
                },
                loginPassword: {
                    required: true
                }
            },
            messages: {
                loginAccount: {
                    required: "<?php echo $this->translate('请输入登录账户信息!'); ?>"
                },
                loginPassword: {
                    required: "<?php echo $this->translate('请输登录密码!'); ?>"
                }
            }
        });
    });
</script>
